<template>
    <!--START post-->
    <div class="m-userlist">
        <mu-list>
            <mu-sub-header>用户列表</mu-sub-header>
            <mu-list-item :title="user.username" v-for="user, index in userList" key="key">
                <mu-avatar :src="user.avatar" slot="leftAvatar" />
                <mu-icon value="chat_bubble" slot="right" />
            </mu-list-item>
        </mu-list>
    </div>
    <!--END post-->
</template>
<script>
import axios from 'axios'
export default {
    name: 'userlist',
    data() {
        return {
            userList: []
        }
    },
    methods: {
        getUsers(){
            axios.get('api/users')
                .then(function(res){
                    this.userList = res.data
                }.bind(this))
        }
    },
    mounted(){
        this.getUsers()
    }
}
</script>
<style scoped lang="scss">

</style>
